package com.baiyue.entity;

import com.baomidou.mybatisplus.enums.IdType;
import java.math.BigDecimal;
import java.util.Date;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import java.io.Serializable;

import com.baomidou.mybatisplus.annotations.Version;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.*;
import lombok.experimental.Accessors;
import org.springframework.validation.annotation.Validated;

/**
 *
 * @author 伍波
 * @date 2024-06-13
 */
@Data
@TableName("product_info")
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Validated
public class ProductInfo implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 商品ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    /**
     * 商品名称
     */
    @TableField("product_name")
    private String productName;
    /**
     * 商品分类ID（对应商品分类表ID）
     */
    @TableField("category_id")
    private Integer categoryId;
    /**
     * 单位
     */
    private String unit;
    /**
     * 售价
     */
    @TableField("sale_price")
    private BigDecimal salePrice;
    /**
     * 进价
     */
    @TableField("purchase_price")
    private BigDecimal purchasePrice;
    /**
     * 商品库存
     */
    @TableField("stock_quantity")
    private Integer stockQuantity;
    /**
     * 创建时间
     */
    @TableField("create_time")
    private Date createTime;
    /**
     * 更新时间
     */
    @TableField("update_time")
    private Date updateTime;
    /**
     * 创建人
     */
    private String creator;
    /**
     * 更新人
     */
    private String updater;
    /**
     * 状态：0-正常，1-删除，2-禁售
     */
    private Integer status;
    /**
     * 开始时间
     */
    @TableField(exist = false)
    private String start;

    /**
     * 结束时间
     */
    @TableField(exist = false)
    private String end;

    /**
     * 排序字段
     */
    @TableField(exist = false)
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private String sortField;

    /**
     * 排序顺序
     * desc  asc
     */
    @TableField(exist = false)
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private String sortValue;

    public ProductInfo(String productName, Integer categoryId, String unit, BigDecimal salePrice,
                       BigDecimal purchasePrice, Integer stockQuantity, Date createTime, Date updateTime,
                       String creator, String updater, Integer status, String start, String end, String sortField,
                       String sortValue) {
        this.productName = productName;
        this.categoryId = categoryId;
        this.unit = unit;
        this.salePrice = salePrice;
        this.purchasePrice = purchasePrice;
        this.stockQuantity = stockQuantity;
        this.createTime = createTime;
        this.updateTime = updateTime;
        this.creator = creator;
        this.updater = updater;
        this.status = status;
        this.start = start;
        this.end = end;
        this.sortField = sortField;
        this.sortValue = sortValue;
    }
}
